//
//  LastCell.m
//  小团购
//
//  Created by 樊荣海 on 15/2/2.
//  Copyright (c) 2015年 樊荣海. All rights reserved.
//

#import "LastCell.h"

@implementation LastCell

- (void)awakeFromNib {
    
    
    _btn.hidden = YES;
    _act.hidesWhenStopped = YES;
    [_act stopAnimating];
    
}


- (instancetype)init {

    if (self == [super init]) {
        
        [_act stopAnimating];
    }
    
    return self;
    
}

- (void)setPage:(int)page {

    _page = page+1;
    _btn.hidden = YES;
    [_act startAnimating];
    
    
    [[DealTool sharedDealTool] dealToolWithPage:_page success:^(NSArray *modelArray) {
        
        
        [_act stopAnimating];
        
        
        if (_block) {
            _block(modelArray);
        }
        
       
        
    } fail:^(NSError *error) {
        
        [_act stopAnimating];
        _btn.hidden = NO;
        
        if (_block) {
            _block([NSArray array]);
        }
    }];
}


- (IBAction)btnClick:(id)sender {
    
    _btn.hidden = YES;
    [self setPage:_page-1];
}
@end
